import {getAbnormalList,getGridList,getGeoList} from '@/api/data/proData'
import {getStageList} from "@/api/data/proDataForup"
const map = {
    state: {
        popupData:{},
        featureData:[],//异常数据列表
        siteData:[],//污染数据列表
      
        gridData:[],    //网格列表

        displayPanel:new Map() //属性设置面板

    },
    mutations: {
        SET_DATA:(state, data) => {
            state.popupData = data;
        },
        SET_FEATUREDATA:(state,val)=>{
            state.featureData=val;
        },
        SET_SITEDATA:(state,val)=>{
            state.siteData=val;
        },
        SET_ZONEID:(state,val)=>{
            state.zoneId=val
         },
         SET_GRIDDATA:(state,val)=>{
            state.gridData = val
        },
        ATTR_PANEL:(state,{key,value})=>{
            state.displayPanel.set(key,value)
        }
    },
    actions: {
        changClickMap({ commit }, val) {
            commit('SET_DATA', val);
        },
        getDesignData({ commit }, paramsInfo){
            return new Promise((resolve, reject) => {
                getAbnormalList(paramsInfo).then(res => {
                    commit('SET_FEATUREDATA',res.data);
                    resolve();
                }).catch(error => {
                    reject(error)
                })
            })
        },
        getGirdData({ commit }, paramsInfo){
            return new Promise((resolve, reject) => {
                getGridList(paramsInfo).then(res => {
                    commit('SET_GRIDDATA',res.data);
                    resolve();
                }).catch(error => {
                    reject(error)
                })
            })
        },
        getGeoListData({ commit }, paramsInfo){
            return new Promise((resolve, reject) => {
                getStageList(paramsInfo).then(res => {
                    commit('SET_SITEDATA',res.result);
                    resolve();
                }).catch(error => {
                    reject(error)
                })
            })
        },

        
    }
}
export default map